<template>
  <div class="index">
    <SideMenu :isCollapse="isCollapse" />
    <div class="content">
      <HeaderBar v-model:isCollapse="isCollapse" />
      <div class="content-main">
        <router-view v-slot="{ Component, route }">
          <transition name="fade" mode="out-in">
            <component :is="Component" :key="route.fullPath" />
          </transition>
        </router-view>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import SideMenu from "@/components/SideMenu.vue";
import HeaderBar from "@/components/HeaderBar.vue";

const isCollapse = ref(false);
</script>

<style scoped lang="scss">
.index {
  display: flex;
  height: 100vh;
  overflow: hidden;

  .content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    .content-main {
      flex: 1;
      padding: 20px;
      overflow: auto;
      background-color: #fff;
    }
  }
}
</style>
